# 题目一：需求编程
# i.	定义了一个学生类：属性:学号，姓名，年龄，性别，身高，体重，成绩，家庭地址，电话号码。
#       行为：学习（要求参数传入学习的时间），玩游戏（要求参数传入游戏名），编程（要求参数传入写代码的行数），数的求和（要求参数用变长参数来做，返回求和结果）
class Student:
    def __init__(self, id, name, age, sex, height, weight, score, address, phone):
        self.id = id
        self.name = name
        self.age = age
        self.sex = sex
        self.height = height
        self.weight = weight
        self.score = score
        self.address = address
        self.phone = phone
    #学习方法
    def Study(self, time):
        print(self.name, '正在学习', time, '小时')

    def Play(self, game):
        print(self.name, '正在玩', game)

    def Code(self, lines):
        print(self.name, '正在写', lines, '行代码')

    def Sum(*args):
        sum = 0
        for i in args:
            sum += i
        return sum

srt=Student('20180001', '张三', 18, '男', 180, 80, 90, '北京', '1234567890')
srt.Study(2)
srt.Play('王者荣耀')
srt.Code(100)
print(Student.Sum(1,2,3,4,5,6,7,8,9,10))

# ii.	车类：属性：车型号，车轮数，车身颜色，车重量，油箱存储大小 。功能：跑（要求参数传入车的具体功能，比如越野，赛车）
# 创建：法拉利，宝马，铃木，五菱，拖拉机对象

class Car:
    def __init__(self, model, wheels, color, weight, tank):
        self.model = model
        self.wheels = wheels
        self.color = color
        self.weight = weight
        self.tank = tank
        self.oil = 0

    def Run(self, function):
        print(self.model, '正在', function)



ferrari = Car('法拉利', 4, '红色', 2000, 100)
bmw = Car('宝马', 4, '蓝色', 2000, 100)
lexus = Car('铃木', 4, '蓝色', 2000, 100)
wuling = Car('五菱', 4, '蓝色', 2000, 100)
tractor = Car('拖拉机', 4, '蓝色', 2000, 100)
ferrari.Run('赛车')
bmw.Run('越野')
lexus.Run('越野')
wuling.Run('越野')
tractor.Run('拖拉机')


# iii.	笔记本：属性：型号，待机时间，颜色，重量，cpu型号，内存大小，硬盘大小。
# 行为：打游戏（传入游戏的名称）,办公。
class Laptop:
    def __init__(self, model, standby, color, weight, cpu, memory, harddisk):
        self.model = model
        self.standby = standby
        self.color = color
        self.weight = weight
        self.cpu = cpu
        self.memory = memory
        self.harddisk = harddisk#

    def Play(self, game):
        print(self.model, '正在玩', game)

    def Work(self):
        print(self.model, '正在办公')

laptop = Laptop('MacBook Pro', '8小时', '银色', '2kg', 'Intel Core i5', '8G', '512G')
laptop.Play('原神')
laptop.Work()

# iv.	猴子类：属性：类别，性别，身体颜色，体重。
#       行为：造火（要求传入造火的材料：比如木棍还是石头），学习事物（要求参数传入学习的具体事物，可以不止学习一种事物）
class Monkey:
    def __init__(self, category, sex, color, weight):
        self.category = category
        self.sex = sex
        self.color = color
        self.weight = weight

    def Fire(self, material):
        print(self.category, '正在造火', material)

    def Learn(self, thing):
        print(self.category, '正在学习', thing)

monkey = Monkey('大猿', '男', '棕色', '100kg')
monkey.Fire('木棍')
monkey.Learn('火making')